# QAI AppBuilder ***Copyright © Quectel Wireless Solutions Co., Ltd. 2026. All rights reserved.*** --- QAI AppBuilder是Qualcomm® AI Runtime SDK的扩展,用于简化QNN模型的部署。使用QAI AppBuilder需要Qualcomm® AI Runtime SDK中的一些库。 QAI AppBuilder旨在帮助开发者轻松地使用Qualcomm® AI Runtime SDK在Windows on Snapdragon (WoS)和Linux平台上执行模型。它将模型执行API封装成一组简化的接口,用于将模型加载到NPU/HTP上并执行推理。这大大降低了开发者部署模型的复杂性。 # 环境配置 ```shell sudo apt install -y wget cmake git g++ pip install tqdm qai-hub py3_wget opencv-python torch torchvision ``` # 资源下载 ```shell #获取QAIRT wget https://softwarecenter.qualcomm.com/api/download/software/sdks/Qualcomm_AI_Runtime_Community/All/2.37.1.250807/v2.37.1.250807.zip unzip -q v2.37.1.250807.zip #获取QAI AppBuilder源码 git clone https://github.com/quic/ai-engine-direct-helper -b v2.38.0 --depth 1 --recursive ``` # 编译和安装QAI AppBuilder ```shell export PRODUCT_SOC=6490 DSP_ARCH=68source qairt/2.37.1.250807/bin/envsetup.sh export ADSP_LIBRARY_PATH=$QNN_SDK_ROOT/lib/hexagon-v${DSP_ARCH}/unsigned export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$QNN_SDK_ROOT/lib/aarch64-oe-linux-gcc11.2 cd ai-engine-direct-helper python3 setup.py bdist_wheel pip3 install setdist/qai_appbuilder-2.34.0-cp313-cp313-linux_aarch64.whl cd - ``` # 运行测试程序 ```plaintext cd ai-engine-direct-helper/samples/linux/python python3 inception_v3/inception_v3.py --image cat.png ``` # 运行日志 ```plaintext Current file directory: /home/p/quectel-pi-ai-engine-direct-helper/ai-engine-direct-helper/samples/linux/python/inception_v3 model_path: /home/p/quectel-pi-ai-engine-direct-helper/ai-engine-direct-helper/samples/linux/python/inception_v3/models/inception_v3.bin 0.0ms [WARNING] Initializing HtpProvider /prj/qct/webtech_scratch20/mlg_user_admin/qaisw_source_repo/rel/qairt-2.37.1/point_release/SNPE_SRC/avante-tools/prebuilt/dsp/hexagon-sdk-5.4.0/ipc/fastrpc/rpcmem/src/rpcmem_android.c:38:dummy call to rpcmem_init, rpcmem APIs will be used from libxdsprpc 163.9ms [WARNING] Time: Read model file to memory. 17.78 183.1ms [WARNING] Time: contextCreateFromBinary. 19.11 183.1ms [WARNING] Time: UnmapViewOfFile. 0.00 188.3ms [WARNING] Time: model_initialize inceptionV3 188.24 217.9ms [WARNING] Time: model_inference inceptionV3 4.11 Top 5 predictions for image: Persian cat 0.964312017 tabby 0.0149575649 bucket 0.0060467576 Angora 0.0020394654 Egyptian cat 0.0020394654 /prj/qct/webtech_scratch20/mlg_user_admin/qaisw_source_repo/rel/qairt-2.37.1/point_release/SNPE_SRC/avante-tools/prebuilt/dsp/hexagon-sdk-5.4.0/ipc/fastrpc/rpcmem/src/rpcmem_android.c:42:dummy call to rpcmem_deinit, rpcmem APIs will be used from libxdsprpc 256.1ms [WARNING] Time: model_destroy inceptionV3 35.37 ``` # 测试图片 ```{image} images/image_EkBAbhD8EomAhkx1aQ3cBpyCnZb.webp :width: 594px :height: 559px ```